
package com.lmx.repoDomain.tmodel;


import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.lmx.repoDomain.tmodel.business.User;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiLookupIncludeAutomatically;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 健康信息表
 */
@JsonApiResource(type = "healthInfo")
@Table(name = "tnb_health_info")
@Entity
public class HealthInfo extends BaseEntity {
	private Device device;
	private Dicttype itemtype;// 体检项目，字典类型：
	private String result;// 体检结果
	private String resultAddtion;// 体检结果补充1
	private String resultAddtionSec;// 体检结果补充2
	private String resultAddtionThir;// 体检结果补充3
	private String resultAddtionFou;// 体检结果补充4
	private String resultAddtionFiv;// 体检结果补充5
	private String resultAddtionSix;// 体检结果补充6
	private String resultAddtionSev;// 体检结果补充7
	private String resultAddtionEig;// 体检结果补充8
	private String resultAddtionNin;// 体检结果补充9
	private String resultAddtionTen;// 体检结果补充10
	private Customer examUser; // 体检人
	private User createUser; // 记录创建者
	private Integer examDateTime;// 体检时间
	private String dataId;// 所接收数据ID
	private Dicttype dataEnterType;// 数据录入类型
	private String remark;// 备注
	private User lastUpdateUser;// 更新操作者userid
	private Long createDateTime;// 创建时间
	private Integer lastUpdateDateTime;// 更新时间
	private String heartImg;// 心电 分析图
	private Integer day; // 当前日期
	private Integer hourSeq; // 当前时间
	private Integer seq; // 表示的是记录的第几条的序号
	
	private String sourceFlag;// 录入标识
	
	private HealthInfoEntry healthentry;//批存

	@Transient
	@JsonApiToOne
	public HealthInfoEntry getHealthentry() {
		return healthentry;
	}

	public void setHealthentry(HealthInfoEntry healthentry) {
		this.healthentry = healthentry;
	}
	
	@Column(name = "source_flag")
	public String getSourceFlag() {
		return sourceFlag;
	}

	public void setSourceFlag(String sourceFlag) {
		if (sourceFlag == null || "".equals(sourceFlag))
			sourceFlag = "fromDevice";
		this.sourceFlag = sourceFlag;
	}

	@JsonApiToOne
	@JsonApiLookupIncludeAutomatically(overwrite=true)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "device_id", foreignKey = @ForeignKey(name = "null"))
	public Device getDevice() {
		return device;
	}

	public void setDevice(Device device) {
		this.device = device;
	}

	@Column(name = "result_addtion_thir")
	public String getResultAddtionThir() {
		return resultAddtionThir;
	}

	public void setResultAddtionThir(String resultAddtionThir) {
		this.resultAddtionThir = resultAddtionThir;
	}

	@Column(name = "result_addtion_fou")
	public String getResultAddtionFou() {
		return resultAddtionFou;
	}

	public void setResultAddtionFou(String resultAddtionFou) {
		this.resultAddtionFou = resultAddtionFou;
	}

	@Column(name = "result_addtion_fiv")
	public String getResultAddtionFiv() {
		return resultAddtionFiv;
	}

	public void setResultAddtionFiv(String resultAddtionFiv) {
		this.resultAddtionFiv = resultAddtionFiv;
	}

	@Column(name = "result_addtion_six")
	public String getResultAddtionSix() {
		return resultAddtionSix;
	}

	public void setResultAddtionSix(String resultAddtionSix) {
		this.resultAddtionSix = resultAddtionSix;
	}

	@Column(name = "result_addtion_sev")
	public String getResultAddtionSev() {
		return resultAddtionSev;
	}

	public void setResultAddtionSev(String resultAddtionSev) {
		this.resultAddtionSev = resultAddtionSev;
	}

	@Column(name = "result_addtion_eig")
	public String getResultAddtionEig() {
		return resultAddtionEig;
	}

	public void setResultAddtionEig(String resultAddtionEig) {
		this.resultAddtionEig = resultAddtionEig;
	}

	@Column(name = "result_addtion_nin")
	public String getResultAddtionNin() {
		return resultAddtionNin;
	}

	public void setResultAddtionNin(String resultAddtionNin) {
		this.resultAddtionNin = resultAddtionNin;
	}

	@Column(name = "result_addtion_ten")
	public String getResultAddtionTen() {
		return resultAddtionTen;
	}

	public void setResultAddtionTen(String resultAddtionTen) {
		this.resultAddtionTen = resultAddtionTen;
	}

	@Column(name = "heart_img", columnDefinition = "TEXT")
	public String getHeartImg() {
		return heartImg;
	}

	public void setHeartImg(String heartImg) {
		this.heartImg = heartImg;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "createDateTime")
	public Long getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Long createDateTime) {
		this.createDateTime = createDateTime;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@JsonApiToOne
	@ManyToOne
	@JoinColumn(name = "lastupdateuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getLastUpdateUser() {
		return lastUpdateUser;
	}

	public void setLastUpdateUser(User lastUpdateUser) {
		this.lastUpdateUser = lastUpdateUser;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "dataentertype", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getDataEnterType() {
		return dataEnterType;
	}

	public void setDataEnterType(Dicttype dataEnterType) {
		this.dataEnterType = dataEnterType;
	}

	@Column(name = "data_id")
	public String getDataId() {
		return dataId;
	}

	public void setDataId(String dataId) {
		this.dataId = dataId;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "itemtype", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getItemtype() {
		return itemtype;
	}

	public void setItemtype(Dicttype itemtype) {
		this.itemtype = itemtype;
	}

	@Column(name = "result")
	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	@Column(name = "result_addtion")
	public String getResultAddtion() {
		return resultAddtion;
	}

	public void setResultAddtion(String resultAddtion) {
		this.resultAddtion = resultAddtion;
	}

	@Column(name = "result_addtion_sec")
	public String getResultAddtionSec() {
		return resultAddtionSec;
	}

	public void setResultAddtionSec(String resultAddtionSec) {
		this.resultAddtionSec = resultAddtionSec;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "exam_user_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getExamUser() {
		return examUser;
	}

	public void setExamUser(Customer examUser) {
		this.examUser = examUser;
	}

	@JsonApiToOne
	// @JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	// @Fetch(FetchMode.JOIN)
	@JoinColumn(name = "create_user_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@Column(name = "exam_datetime")
	public Integer getExamDateTime() {
		return examDateTime;
	}

	public void setExamDateTime(Integer examDateTime) {
		this.examDateTime = examDateTime;
	}

	@Transient
	public Integer getDay() {
		return day;
	}

	public void setDay(Integer day) {
		this.day = day;
	}

	@Transient
	public Integer getHourSeq() {
		return hourSeq;
	}

	public void setHourSeq(Integer hourSeq) {
		this.hourSeq = hourSeq;
	}

	@Transient
	public Integer getSeq() {
		return seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}

}
